package com.huslee.shark.log.log4j2.plugins;

import com.fasterxml.jackson.databind.ObjectWriter;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.layout.AbstractStringLayout;
import org.apache.logging.log4j.util.Strings;

import java.nio.charset.Charset;

/**
 * @author: zhanglin574@xdf.cn
 * @date: 2021/8/10
 * @description:
 */
public abstract class AbstractElkJacksonLayout extends AbstractStringLayout {
    protected static final String DEFAULT_EOL = "\r\n";
    protected static final String COMPACT_EOL = Strings.EMPTY;
    protected final String eol;
    protected final ObjectWriter objectWriter;
    protected final boolean compact;
    protected final boolean complete;
    protected final boolean includeNullDelimiter;
    protected AbstractElkJacksonLayout(final Configuration config, final ObjectWriter objectWriter, final Charset charset,
                                    final boolean compact, final boolean complete, final boolean eventEol, final String endOfLine, final Serializer headerSerializer,
                                    final Serializer footerSerializer, final boolean includeNullDelimiter) {
        super(config, charset, headerSerializer, footerSerializer);
        this.objectWriter = objectWriter;
        this.compact = compact;
        this.complete = complete;
        this.eol = endOfLine != null ? endOfLine : compact && !eventEol ? COMPACT_EOL : DEFAULT_EOL;
        this.includeNullDelimiter = includeNullDelimiter;
    }
    @Override
    public String toSerializable(LogEvent event) {
        return null;
    }


}
